
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>system.Traits</title>
<link rel="stylesheet" type="text/css" href="candydoc/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="candydoc/ie56hack.css"><![endif]-->
<script language="JavaScript" src="candydoc/util.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/explorer.js" type="text/javascript"></script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("system.Traits");</script>
	<table class="content">
		<tr><td id="docbody"><h1>system.Traits</h1><!-- Generated by Ddoc from F:\MyWork\phoenix\source\system\Traits.d -->
The traits module defines tools useful for obtaining detailed type information at compile-time.
 
<br><br>


<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">ReturnType</span>
<script>explorer.outline.addDecl('ReturnType');</script>

(alias dg)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get the type of the return value from a function,
 a pointer to function, or a delegate.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">ParameterTypeTuple</span>
<script>explorer.outline.addDecl('ParameterTypeTuple');</script>

(alias dg)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get the types of the paramters to a function,
 a pointer to function, or a delegate as a tuple.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">FieldTypeTuple</span>
<script>explorer.outline.addDecl('FieldTypeTuple');</script>

(S)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get the types of the fields of a struct or class.
 This consists of the fields that take up memory space,
 excluding the hidden fields like the virtual function
 table pointer.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">BaseTypeTuple</span>
<script>explorer.outline.addDecl('BaseTypeTuple');</script>

(A)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get a TypeTuple of the base class and base interfaces of
 this class or interface.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">BaseClassesTuple</span>
<script>explorer.outline.addDecl('BaseClassesTuple');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get a <i>TypeTuple</i> of <i>all</i> base classes of this class,
 in decreasing order. Interfaces are not included. <i>
<span class="currsymbol">BaseClassesTuple</span>
<script>explorer.outline.addDecl('BaseClassesTuple');</script>

!(Object)</i> yields the empty type tuple.
<br><br>
<b>Example:</b><br>
<pre class="d_code"> <font color=blue>import</font> system.traits, system.tuple;
 <font color=blue>interface</font> I { }
 <font color=blue>class</font> A { }
 <font color=blue>class</font> B : A, I { }
 <font color=blue>class</font> C : B { }

 <font color=blue>void</font> main()
 {
     <font color=blue>alias</font> <u>BaseClassesTuple</u>!(C) TL;
     writeln(<font color=blue>typeid</font>(TL));	<font color=green>// prints: (B,A,Object)
</font> }
</pre>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">InterfacesTuple</span>
<script>explorer.outline.addDecl('InterfacesTuple');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get a <i>TypeTuple</i> of <i>all</i> interfaces directly or
 indirectly inherited by this class or interface. Interfaces do not
 repeat if multiply implemented. <i>
<span class="currsymbol">InterfacesTuple</span>
<script>explorer.outline.addDecl('InterfacesTuple');</script>

!(Object)</i>
 yields the empty type tuple.
<br><br>
<b>Example:</b><br>
<pre class="d_code"> <font color=blue>import</font> std.traits, std.typetuple, std.stdio;
 <font color=blue>interface</font> I1 { }
 <font color=blue>interface</font> I2 { }
 <font color=blue>class</font> A : I1, I2 { }
 <font color=blue>class</font> B : A, I1 { }
 <font color=blue>class</font> C : B { }

 <font color=blue>void</font> main()
 {
     <font color=blue>alias</font> <u>InterfacesTuple</u>!(C) TL;
     writeln(<font color=blue>typeid</font>(TL));	<font color=green>// prints: (I1, I2)
</font> }
</pre>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">TransitiveBaseTuple</span>
<script>explorer.outline.addDecl('TransitiveBaseTuple');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get a <i>TypeTuple</i> of <i>all</i> base classes of <i>T</i>, in decreasing order, followed by <i>T</i>'s
 interfaces. <i>TransitiveBaseTypeTuple!(Object)</i> yields the
 empty type tuple.
<br><br>
<b>Example:</b><br>
<pre class="d_code"> <font color=blue>import</font> system.traits, system.tuple;
 <font color=blue>interface</font> I { }
 <font color=blue>class</font> A { }
 <font color=blue>class</font> B : A, I { }
 <font color=blue>class</font> C : B { }

 <font color=blue>void</font> main()
 {
     <font color=blue>alias</font> TransitiveBaseTypeTuple!(C) TL;
     writeln(<font color=blue>typeid</font>(TL));	<font color=green>// prints: (B,A,Object,I)
</font> }
</pre>
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">CommonType</span>
<script>explorer.outline.addDecl('CommonType');</script>

(T...)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Get the type that all types can be implicitly converted to. Useful
e.g. in figuring out an array type from a bunch of initializing
values. Returns <i>void</i> if passed an empty list, or if the
types have no common type.
<br><br>
<b>Example:</b><br>
<pre class="d_code"><font color=blue>alias</font> <u>CommonType</u>!(<font color=blue>int</font>, <font color=blue>long</font>, <font color=blue>short</font>) X;
<font color=blue>assert</font>(<font color=blue>is</font>(X == <font color=blue>long</font>));
<font color=blue>alias</font> <u>CommonType</u>!(<font color=blue>int</font>, <font color=blue>char</font>[], <font color=blue>short</font>) Y;
<font color=blue>assert</font>(<font color=blue>is</font>(Y == <font color=blue>void</font>));
</pre>
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">ImplicitConversionTargets</span>
<script>explorer.outline.addDecl('ImplicitConversionTargets');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Returns a tuple with all possible target types of an implicit
 conversion of a value of type <i>T</i>.
<br><br>
Important note:
<br><br>

 The possible targets are computed more conservatively than the D
 2.005 compiler does, eliminating all dangerous conversions. For
 example, <i>
<span class="currsymbol">ImplicitConversionTargets</span>
<script>explorer.outline.addDecl('ImplicitConversionTargets');</script>

!(double)</i> does not
 include <i>float</i>.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsSomeString</span>
<script>explorer.outline.addDecl('IsSomeString');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether T is one of the built-in string types
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsExpressionTuple</span>
<script>explorer.outline.addDecl('IsExpressionTuple');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Tell whether the tuple T is an expression tuple.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsStaticArray</span>
<script>explorer.outline.addDecl('IsStaticArray');</script>

(T : U[N],U,size_t N)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a static array.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsDynamicArray</span>
<script>explorer.outline.addDecl('IsDynamicArray');</script>

(T,U = void)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a dynamic array.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsAssociateArray</span>
<script>explorer.outline.addDecl('IsAssociateArray');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is an associate array.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsArray</span>
<script>explorer.outline.addDecl('IsArray');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is an array.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsCharType</span>
<script>explorer.outline.addDecl('IsCharType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a char type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsSignedIntegerType</span>
<script>explorer.outline.addDecl('IsSignedIntegerType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a signed integer type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsUnsignedIntegerType</span>
<script>explorer.outline.addDecl('IsUnsignedIntegerType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect  whether type T is an unsigned integer type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsIntegerType</span>
<script>explorer.outline.addDecl('IsIntegerType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is an integer type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsRealType</span>
<script>explorer.outline.addDecl('IsRealType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a real type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsImaginaryType</span>
<script>explorer.outline.addDecl('IsImaginaryType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is an imaginary type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsComplexType</span>
<script>explorer.outline.addDecl('IsComplexType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a complex type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsFloatingPointType</span>
<script>explorer.outline.addDecl('IsFloatingPointType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is floating-point type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsPointerType</span>
<script>explorer.outline.addDecl('IsPointerType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a pointer type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsReferenceType</span>
<script>explorer.outline.addDecl('IsReferenceType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a reference type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsCallableType</span>
<script>explorer.outline.addDecl('IsCallableType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a callable type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsPrimitiveType</span>
<script>explorer.outline.addDecl('IsPrimitiveType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a primitive type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">IsNumericType</span>
<script>explorer.outline.addDecl('IsNumericType');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Detect whether type T is a numeric type.
 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">template 
<span class="currsymbol">Unsigned</span>
<script>explorer.outline.addDecl('Unsigned');</script>

(T)</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Returns the corresponding unsigned type for T. T must be a numeric
 integral type, otherwise a compile-time error occurs.
 
<br><br>

</dd>
</dl>
<script>explorer.outline.decSymbolLevel();</script>


</td></tr>
		<tr><td id="docfooter">
			Page was generated with
			<img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px">
			on Sat Nov 29 22:33:13 2008

		</td></tr>
	</table>
</div>
<script>
	explorer.packageExplorer.addModule("platform.PAL");
	explorer.packageExplorer.addModule("platform.windows.Core");
	explorer.packageExplorer.addModule("platform.linux.Core");
	explorer.packageExplorer.addModule("system.Array");
	explorer.packageExplorer.addModule("system.BitArray");
	explorer.packageExplorer.addModule("system.Environment");
	explorer.packageExplorer.addModule("system.Event");
	explorer.packageExplorer.addModule("system.Exception");
	explorer.packageExplorer.addModule("system.Hash");
	explorer.packageExplorer.addModule("system.IntPtr");
	explorer.packageExplorer.addModule("system.Random");
	explorer.packageExplorer.addModule("system.Traits");
	explorer.packageExplorer.addModule("system.TypeTuple");
	explorer.packageExplorer.addModule("system.math.IEEE");
	explorer.packageExplorer.addModule("system.math.Math");
	explorer.packageExplorer.addModule("system.runtime.c.complex");
	explorer.packageExplorer.addModule("system.runtime.c.config");
	explorer.packageExplorer.addModule("system.runtime.c.ctype");
	explorer.packageExplorer.addModule("system.runtime.c.errno");
	explorer.packageExplorer.addModule("system.runtime.c.fenv");
	explorer.packageExplorer.addModule("system.runtime.c.inttypes");
	explorer.packageExplorer.addModule("system.runtime.c.limits");
	explorer.packageExplorer.addModule("system.runtime.c.locale");
	explorer.packageExplorer.addModule("system.runtime.c.math");
	explorer.packageExplorer.addModule("system.runtime.c.signal");
	explorer.packageExplorer.addModule("system.runtime.c.stdarg");
	explorer.packageExplorer.addModule("system.runtime.c.stddef");
	explorer.packageExplorer.addModule("system.runtime.c.stdint");
	explorer.packageExplorer.addModule("system.runtime.c.stdio");
	explorer.packageExplorer.addModule("system.runtime.c.stdlib");
	explorer.packageExplorer.addModule("system.runtime.c.string");
	explorer.packageExplorer.addModule("system.runtime.c.time");
	explorer.packageExplorer.addModule("system.runtime.c.wctype");
	explorer.packageExplorer.addModule("system.text.UTF");
	explorer.packageExplorer.addModule("system.threading.Atomic");
	explorer.packageExplorer.addModule("system.threading.ThreadUtility");
	explorer.packageExplorer.addModule("system.threading.synchronization.SpinWait");
	explorer.packageExplorer.addModule("system.collections.ArrayList");
	explorer.packageExplorer.addModule("system.collections.Comparer");
	explorer.packageExplorer.addModule("system.collections.Deque");
	explorer.packageExplorer.addModule("system.collections.EqualityComparer");
	explorer.packageExplorer.addModule("system.collections.Exception");
	explorer.packageExplorer.addModule("system.collections.HashMap");
	explorer.packageExplorer.addModule("system.collections.HashSet");
	explorer.packageExplorer.addModule("system.collections.ICollection");
	explorer.packageExplorer.addModule("system.collections.IComparer");
	explorer.packageExplorer.addModule("system.collections.IDeque");
	explorer.packageExplorer.addModule("system.collections.IEnumerable");
	explorer.packageExplorer.addModule("system.collections.IEnumerator");
	explorer.packageExplorer.addModule("system.collections.IEqualityComparer");
	explorer.packageExplorer.addModule("system.collections.IList");
	explorer.packageExplorer.addModule("system.collections.IMap");
	explorer.packageExplorer.addModule("system.collections.IQueue");
	explorer.packageExplorer.addModule("system.collections.LinkedList");
	explorer.packageExplorer.addModule("system.collections.Pair");
	explorer.packageExplorer.addModule("system.collections.PrimeHelper");
	explorer.packageExplorer.addModule("system.collections.PriorityQueue");
	explorer.packageExplorer.addModule("system.collections.Queue");
	explorer.packageExplorer.addModule("system.collections.RBTree");
	explorer.packageExplorer.addModule("system.collections.Stack");
	explorer.packageExplorer.addModule("system.collections.TreeMap");
	explorer.packageExplorer.addModule("system.collections.TreeSet");
	explorer.packageExplorer.addModule("system.collections.objectmodel.ListCollection");
	explorer.packageExplorer.addModule("system.collections.objectmodel.ReadOnlyListCollection");</script>
</body></html>


